<!--校内横向课题管理的页面，包含已完结，立项申请，结项申请的三个tab页面-->
<!DOCTYPE html>
<!--<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">-->
<html lang="zh" xmlns:th="http://www.thymeleaf.org"
      xmlns:shiro="https://github.com/theborakompanioni/thymeleaf-extras-shiro"
      xmlns:padding="http://www.w3.org/1999/xhtml">

<head>
  <th:block th:include="include :: header('成果转化列表')"/>
</head>
<style>
  .track-rcol {
    width: 100%;
    max-width: 500px;
    margin: 20px auto;
    /*width: 450px;*/
    /*!*border: 1px solid #eee;*!*/
    /*margin: 20px auto;*/
    /*background: transparent;*/
    max-height: 400px;
    overflow-y: auto;
  }
  .btn-group-sm > .btn, .btn-sm {
    padding: 9px 10px;
    font-size: 12px;
    line-height: 1.5;
    border-radius: 3px;
  }

  .link-button {
    background: none;
    border: none;
    color: #2c99ff;
    cursor: pointer;
    font-size: inherit;
  }

  .del-link-button {
    background: none;
    border: none;
    color: #ff0000;
    cursor: pointer;
    font-size: inherit;
  }


  .modal-right {
    position: fixed;
    right: 0;
    margin: 0;
    height: 100%;
    display: flex;
    align-items: stretch;
  }

  .modal-right .modal-content {
    height: 100%;
    width: 70%;
    margin-left: auto;
  }

  .modal-right .but {
    position: absolute;
    right: 2%;
    bottom: 1.3%;
    background: red;
    color: white;
    border: none;
    border-radius: 4px;
  }

  .progress_inner {
    height: 80px;
    width: 100%;
    position: relative;
  }

  .progress_inner__step {
    width: 33.33%;
    font-size: 12px;
    padding: 0 5px;
    transition: all 0.4s;
    float: left;
    text-align: center;
    position: relative;
  }

  .progress_inner__step label {
    padding-top: 30px;
    display: block;
    position: relative;
    cursor: pointer;
  }

  .progress_inner__step:before {
    content: "1";
    width: 24px;
    height: 24px;
    color: #2196F3;
    background: white;
    line-height: 22px;
    border: 2px solid #2196F3;
    font-size: 12px;
    top: 0;
    border-radius: 50%;
    transition: all 0.4s;
    position: absolute;
    left: 0;
    right: 0;
    margin: auto;
    font-weight: bold;
    z-index: 11;
  }

  .progress_inner__step:nth-of-type(2):before {
    content: "2";
    color: #9E9E9E;
    border-color: #9E9E9E;
  }

  .progress_inner__step:nth-of-type(3):before {
    content: "3";
    color: #9E9E9E;
    border-color: #9E9E9E;
  }

  .progress_inner__step.completed:before {
    content: "✓";
    color: #4CAF50;
    border-color: #4CAF50;
    line-height: 22px;
    font-size: 14px;
  }

  .progress_inner__step.active:before {
    color: #2196F3;
    border-color: #2196F3;
    background: white;
  }

  .progress_inner__step.pending:before {
    color: #9E9E9E;
    border-color: #9E9E9E;
    background: white;
  }

  .progress_inner__bar {
    height: 3px;
    left: 16.665%;
    right: 16.665%;
    background: #E0E0E0;
    position: absolute;
    top: 12px;
    z-index: -1;
    border-radius: 3px;
    overflow: hidden;
  }

  .progress_inner__bar--progress {
    height: 100%;
    background: #4CAF50;
    width: 0;
    transition: width 0.6s ease;
  }


  .status-text {
    color: #9E9E9E;
    font-weight: normal;
    transition: all 0.4s;
    font-size: 12px;
  }

  .status-text.active {
    color: #2196F3;
    font-weight: bold;
  }

  .status-text.completed {
    color: #4CAF50;
    font-weight: bold;
  }

  .buttons {
    margin-top: 20px;
    text-align: center;
  }

  button {
    background: #2196F3;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 3px;
    margin: 0 8px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s;
    font-size: 12px;
  }

  button:hover {
    background: #1976D2;
  }

  button:last-child {
    background: #9E9E9E;
  }

  button:last-child:hover {
    background: #757575;
  }

  /* 新增的流程记录样式 */
  .timeline-title {
    font-weight: bold;
    font-size: 14px;
    color: #333;
    text-align: left;
    margin: 0 0 25px 20px;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
    position: relative;
    padding-bottom: 15px;
  }

  .timeline-title::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 0.5px;
    /*background: linear-gradient(to right, #e0e0e0, #a0a0a0, #e0e0e0);*/
    background: linear-gradient(to right,
    rgba(224, 224, 224, 0.8),
    rgba(224, 224, 224, 0.8),
    rgba(224, 224, 224, 0.8)); /* 添加透明度使线条更柔和 */
    box-shadow: 0 0.5px 1px rgba(0, 0, 0, 0.07);
  }

  .track-rcol {
    width: 100%;
    max-width: 500px;
    margin: 20px auto;
    /*width: 450px;*/
    /*!*border: 1px solid #eee;*!*/
    /*margin: 20px auto;*/
    /*background: transparent;*/
  }

  .track-list {
    margin: 20px;
    padding-left: 5px;
    position: relative;
  }

  .track-list ul {
    padding-left: 0;
  }

  .track-list li {
    position: relative;
    padding: 5px 0 10px 25px;
    line-height: 1.4;
    border-left: 2px solid #d9d9d9;
    color: #666;
    list-style: none;
    /*text-align: left;*/
    transition: all 0.4s ease; /* 添加过渡效果 */
  }

  .track-list li.first {
    color: #666;
    padding-top: 0;
    /*border-left-color: #fff;*/
  }

  .track-list li .node-icon {
    position: absolute;
    left: -6px;
    top: 18px;
    width: 8px; /* 调圆点*/
    height: 8px;
    background: #C0C0C0;
    border-radius: 50%;
    transition: all 0.4s ease; /* 添加过渡效果 */
    border: 2px solid #E0E0E0;
    box-sizing: content-box;
  }

  .track-list li.first .node-icon {
    background: #C0C0C0; /* 天蓝色 */
    width: 8px;
    height: 8px;
    left: -8px;
  }

  .track-list li .time {
    display: block;
    margin-bottom: 3px;
    font-size: 11px;
    color: #888;
    transition: all 0.4s ease; /* 添加过渡效果 */
  }

  .track-list li .txt {
    display: block;
    font-size: 12px;
    transition: all 0.4s ease; /* 添加过渡效果 */
  }

  /* 悬停效果 */
  .track-list li:hover {
    color: #333;
  }

  .track-list li:hover .node-icon {
    transform: scale(1.3);
    background: #ed8088;
  }

  .track-list li:hover .time {
    color: #666;
  }

  /* 新增审核状态样式 */
  .approve-status {
    margin-top: 10px;
    text-align: center;
  }

  .approve-status label {
    margin: 0 10px;
    cursor: pointer;
  }

  .approve-status input {
    margin-right: 5px;
  }


</style>
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeIn">

  <div class="row">

    <div class="tabs-container">
      <ul class="nav nav-tabs">
        <li class="active"><a data-toggle="tab" href="#tab-0" onclick="$.table.refresh('bootstrap-table0')" aria-expanded="true">已完结</a>
        </li>
        <li class=""><a data-toggle="tab" href="#tab-1" onclick="$.table.refresh('bootstrap-table1')" aria-expanded="false"> 立项申请</a>
        </li>

        <li class=""><a data-toggle="tab" href="#tab-2"  onclick="$.table.refresh('bootstrap-table2')" aria-expanded="false" >结项申请</a>
        </li>

      </ul>
      <div class="tab-content">
        <div id="tab-0" class="tab-pane active">
          <div class="panel-body">
            <div class="container-div">
              <div class="row">
                <div class="col-sm-12 search-collapse" shiro:hasPermission="['system:intraSch:select']">
                  <form id="formId0">
                    <!--                                        <div class="select-list"+[[${@permission.hasPermi('system:intraSch:select')}]]>-->
                    <div class="select-list" v-hasPermi="['system:intraSch:select']">
                      <ul>
                        <li>
                          <label>申请人：</label>
                          <input type="text" name="userName"/>
                        </li>
                        <li>
                          <label>课题名称：</label>
                          <input type="text" name="topName"/>
                        </li>
                        <li>
                          <label>专业名称：</label>
                          <input type="text" name="deptname"/>
                        </li>
                        <!--                                                <li>-->
                        <!--                                                    <label>状态：</label>-->
                        <!--                                                    <select name="state"-->
                        <!--                                                            th:with="type=${@dict.getType('sys_intraschpro_tasks')}">-->
                        <!--                                                        <option value="">所有</option>-->
                        <!--                                                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}"-->
                        <!--                                                                th:value="${dict.dictValue}"></option>-->
                        <!--                                                    </select>-->
                        <!--                                                </li>-->


                        <li>
                          <a class="btn btn-primary btn-rounded btn-sm"
                             onclick="$.table.search('formId0','bootstrap-table0')"><i
                            class="fa fa-search"></i>&nbsp;搜索</a>
                          <a class="btn btn-warning btn-rounded btn-sm"
                             onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                      </ul>
                    </div>
                  </form>
                </div>

                <div class="btn-group-sm" id="toolbar0" role="group"
                     style="display: flex; justify-content: space-between; align-items: center; width: 100%;">
                  <!--                                    <a class="btn btn-success" onclick="$.operate.addTab()" shiro:hasPermission="system:apply:add">-->
                  <!--                                        <i class="fa fa-plus"></i> 添加-->
                  <!--                                    </a>-->
                  <!--                <a class="btn btn-primary single disabled" onclick="$.operate.editTab()" shiro:hasPermission="system:apply:edit">-->
                  <!--                    <i class="fa fa-edit"></i> 修改-->
                  <!--                </a>-->
                  <!--                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:apply:remove">-->
                  <!--                     </i> 删除-->
                  <!--                </a>-->
                  <!--<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:apply:list">
                      <i class="fa fa-download"></i> 导出
                  </a>-->
                  <div
                    style="display: flex; align-items: center; gap: 15px; background: #f8f9fa; padding: 6px 12px; border-radius: 4px;">
                    <th:block th:replace="include :: status-circles"/>
                  </div>
                </div>
                <div class="col-sm-12 select-table table-striped">
                  <table id="bootstrap-table0"></table>
                </div>
              </div>
            </div>


          </div>
        </div>
        <div id="tab-1" class="tab-pane ">
          <div class="panel-body">
            <div class="container-div">
              <div class="row">
                <div class="col-sm-12 search-collapse" shiro:hasPermission="['system:intraSch:select']">
                  <form id="formId1">
                    <!--                                        <div class="select-list">-->
                    <div class="select-list">
                      <ul>
                        <li>
                          <label>申请人：</label>
                          <input type="text" name="userName"/>
                        </li>
                        <li>
                          <label>课题名称：</label>
                          <input type="text" name="topName"/>
                        </li>
                        <li>
                          <label>专业名称：</label>
                          <input type="text" name="dname"/>
                        </li>
                        <!--                                                <li>-->
                        <!--                                                    <label>状态：</label>-->
                        <!--                                                    <select name="state"-->
                        <!--                                                            th:with="type=${@dict.getType('sys_intraschpro_tasks')}">-->
                        <!--                                                        <option value="">所有</option>-->
                        <!--                                                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}"-->
                        <!--                                                                th:value="${dict.dictValue}"></option>-->
                        <!--                                                    </select>-->
                        <!--                                                </li>-->

                        <li>
                          <a class="btn btn-primary btn-rounded btn-sm"
                             onclick="$.table.search('formId1','bootstrap-table1')"><i
                            class="fa fa-search"></i>&nbsp;搜索</a>
                          <a class="btn btn-warning btn-rounded btn-sm"
                             onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                      </ul>
                    </div>
                  </form>
                </div>

                <div class="btn-group-sm" id="toolbar1" role="group" style="display: inline-flex; gap: 4px; ">
                  <a class="btn btn-success " padding="10px 10px" onclick="$.operate.addTab()"
                     shiro:hasPermission="system:apply:add">
                    <i class="fa fa-plus"></i> 添加
                  </a>
                  <!--                <a class="btn btn-primary single disabled" onclick="$.operate.editTab()" shiro:hasPermission="system:apply:edit">-->
                  <!--                    <i class="fa fa-edit"></i> 修改-->
                  <!--                </a>-->
                  <!--                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:apply:remove">-->
                  <!--                     </i> 删除-->
                  <!--                </a>-->
                  <a class="btn btn-warning" onclick="$.table.exportExcel()"
                     shiro:hasPermission="system:apply:export">
                    <i class="fa fa-download"></i> 导出
                  </a>
                  <div
                    style="display: flex; align-items: center; gap: 15px; background: #f8f9fa; padding: 6px 12px; border-radius: 4px;">
                    <th:block th:replace="include :: status-circles"/>
                  </div>
                </div>

                <div class="col-sm-12 select-table table-striped">
                  <table id="bootstrap-table1"></table>
                </div>
              </div>
            </div>
          </div>
        </div>
        <div id="tab-2" class="tab-pane">
          <div class="panel-body">
            <div class="container-div">
              <div class="row">
                <div class="col-sm-12 search-collapse" shiro:hasPermission="['system:intraSch:select']">
                  <form id="formId2">
                    <div class="select-list">
                      <ul>
                        <li>
                          <label>申请人：</label>
                          <input type="text" name="userName"/>
                        </li>
                        <li>
                          <label>课题名称：</label>
                          <input type="text" name="topName"/>
                        </li>
                        <li>
                          <label>专业名称：</label>
                          <input type="text" name="deptname"/>
                        </li>
                        <!--                                                <li>-->
                        <!--                                                    <label>状态：</label>-->
                        <!--                                                    <select name="state"-->
                        <!--                                                            th:with="type=${@dict.getType('sys_intraschpro_tasks')}">-->
                        <!--                                                        <option value="">所有</option>-->
                        <!--                                                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}"-->
                        <!--                                                                th:value="${dict.dictValue}"></option>-->
                        <!--                                                    </select>-->
                        <!--                                                </li>-->
                        <li>
                          <a class="btn btn-primary btn-rounded btn-sm"
                             onclick="$.table.search('formId2','bootstrap-table2')"><i
                            class="fa fa-search"></i>&nbsp;搜索</a>
                          <a class="btn btn-warning btn-rounded btn-sm"
                             onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                      </ul>
                    </div>
                  </form>
                </div>

                <div class="btn-group-sm" id="toolbar2" role="group">
                  <!--                                    <a class="btn btn-success" onclick="$.operate.addTab()">-->
                  <!--                                        <i class="fa fa-plus"></i> 添加-->
                  <!--                                    </a>-->
                  <!--                <a class="btn btn-primary single disabled" onclick="$.operate.editTab()" shiro:hasPermission="system:apply:edit">-->
                  <!--                    <i class="fa fa-edit"></i> 修改-->
                  <!--                </a>-->
                  <!--                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:apply:remove">-->
                  <!--                     </i> 删除-->
                  <!--                </a>-->
                  <a class="btn btn-warning" onclick="$.table.exportExcel()"
                     shiro:hasPermission="system:apply:export">
                    <i class="fa fa-download"></i> 导出
                  </a>
                  <div
                    style="display: flex; align-items: center; gap: 15px; background: #f8f9fa; padding: 6px 12px; border-radius: 4px;">
                    <th:block th:replace="include :: status-circles"/>
                  </div>
                </div>
                <div class="col-sm-12 select-table table-striped">
                  <table id="bootstrap-table2"></table>
                </div>
              </div>
            </div>
          </div>
        </div>


      </div>
    </div>
  </div>
</div>


<div class="wrapper wrapper-content fadeInRight" style="position: absolute; left: -9999px;">
  <div class="row">
    <div class="col-sm-4">
      <div class="ibox ">
        <div class="ibox-content">
          <div class="modal inmodal" id="myModal" tabindex="-1" role="dialog" aria-hidden="true">
            <div class="modal-dialog modal-right">
              <div class="modal-content animated bounceInRight">
                <div class="modal-header">
                  <!--                                    <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span-->
                  <!--                                            class="sr-only">关闭</span>-->
                  <!--                                    </button>-->
                  <div class="timeline-title">流程记录</div>

                  <!-- 原有的流程进度条部分 -->
                  <div>
                  <div class='progress_inner'>
                    <div class='progress_inner__step active' id='step-1'>
                      <label for='step-1'><span class="status-text active">待提交</span></label>
                    </div>
                    <div class='progress_inner__step pending' id='step-2'>
                      <label for='step-2'><span class="status-text">审核中</span></label>
                    </div>
                    <div class='progress_inner__step pending' id='step-3'>
                      <label for='step-3'><span class="status-text">已完成</span></label>
                    </div>
                    <div class='progress_inner__bar' style="z-index: 10">
                      <div class='progress_inner__bar--progress' id='progress-bar'></div>
                    </div>
                  </div>
                </div>
                </div>
                <div class="modal-body">
                  <!-- 流程记录标题 - 放在左上角 -->
                  <!-- 流程记录内容 - 放在流程图下方 -->
                  <div class="track-rcol">
                    <div class="track-list">
                      <ul id="event-list">
                        <li class="first">
                          <i class="node-icon"></i>
                          <span class="time" id="current-time">等待操作...</span>
                          <span class="txt">[新增] - 哈尔滨信息工程学院</span>
                        </li>
                      </ul>
                    </div>
                  </div>

                  <!--                                    <div class="approve-status">-->
                  <!--                                        <label><input type="radio" name="approve" value="pass" checked> 审核通过</label>-->
                  <!--                                        <label><input type="radio" name="approve" value="reject"> 审核未通过</label>-->
                  <!--                                    </div>-->

                  <!--                                    <div class="buttons">-->
                  <!--                                        <button onclick="submitForm()">提交</button>-->
                  <!--                                        <button onclick="approveForm()">审核</button>-->
                  <!--                                        <button onclick="resetForm()">重置</button>-->
                  <!--                                    </div>-->
                </div>
                <div class="modal-footer">
                  <button type="button" class="btn btn-white but" data-dismiss="modal">关闭</button>
                </div>
              </div>
            </div>
          </div>

        </div>
      </div>
    </div>
  </div>
</div>

<th:block th:include="include :: footer"/>
<script th:inline="javascript">
  var JYPY = [[${@permission.hasPermi('system:intraSch:JYPY')}]];
  var XYPY = [[${@permission.hasPermi('system:intraSch:XYPY')}]];
  var KYPY = [[${@permission.hasPermi('system:intraSch:KYPY')}]];

  var JYCH = [[${@permission.hasPermi('system:intraSch:JYCH')}]];
  var XYCH = [[${@permission.hasPermi('system:intraSch:XYCH')}]];
  var KYCH = [[${@permission.hasPermi('system:intraSch:KYCH')}]];
  var select = [[${@permission.hasPermi('system:intraSch:select')}]];

  //var datas = [[${@dict.getType('sys_intraschpro_tasks')}]];
  //科研项目的状态，在sys_dict_data,sys_dict_type(横向课题状态)
  var datas = [[${@dict.getType('sys_intraschpro_tasks')}]];
  var prefix = ctx + "IntraSchPro";

  // 动态生成URL
  function getUrl(tableId) {
    var year = localStorage.getItem("year");
    return prefix + "/list/" + tableId + "?year=" + year;
  }

  $(function () {

    function initTable(options) {
      // 获取当前表格的ID
      var tableId = options.id;
      // 根据表格ID生成URL
      options.url = getUrl(tableId);
      // 使用生成的选项初始化表格
      $.table.init(options);
    }

    // tab-0
    var options0 = {
      id: "bootstrap-table0",
      toolbar: "toolbar0",
      url: getUrl($('table').attr('id')),
      createUrl: prefix + "/add",
      detailUrl: prefix + "/overdetail/{id}",
      updateUrl: prefix + "/edit/{id}",
      removeUrl: prefix + "/remove",
      exportUrl: prefix + "/export",
      rowStyle: rowStyle0,
      modalName: "成果转化",
      sortOrder: "asc",
      columns: [{
        field: 'number',
        title: '序号',
        width: 5,
        align: 'center',
        switchable: false,

        formatter: function (value, row, index) {
          //return index+1; //序号正序排序从1开始

          //通过表的#id 可以得到每页多少条
          var pageSize = $('#bootstrap-table').bootstrapTable('getOptions').pageSize;
          //通过表的#id 可以得到当前第几页
          var pageNumber = $('#bootstrap-table').bootstrapTable('getOptions').pageNumber;
          //返回每条的序号： 每页条数 * （当前页 - 1 ）+ 序号
          // return pageSize * (pageNumber - 1) + index + 1;
          return $.table.serialNumber(index);
        }
      },
        {
          field: 'id',
          title: '',
          visible: false
        },
        {
          field: 'yname',
          align: 'center',
          title: '学院'
        },
        {
          field: 'dname',
          align: 'center',
          title: '专业'
        },
        {
          field: 'userName',
          align: 'center',
          title: '申请人'
        },
        {
          field: 'topName',
          align: 'center',
          title: '课题名称'
        },
        // {
        //     field: 'topType',
        //     title: '课题类型',
        //     formatter: function(value, row, index) {
        //        return $.table.selectDictLabel(topTypeDatas, value);
        //     }
        // },

        {
          field: 'signingData',
          align: 'center',
          title: '签订日期'
        },
        {
          field: 'amount',
          align: 'center',
          title: '项目金额'
        },
        // {
        //   field: 'pa',
        //   align: 'center',
        //   title: '甲方'
        // },
        // {
        //   field: 'pb',
        //   align: 'center',
        //   title: '乙方'
        // },
        // {
        //   field: 'state',
        //   title: '申请状态',
        //   align: 'center',
        //   formatter: function (value, row, index) {
        //     return $.table.selectDictLabel(datas, value);
        //   }
        // },
        {
          field: 'responsibilityTier',
          title: '责任层级',
          align: 'center',
          formatter: function (value, row, index) {
            return row.firstPersonId == row.uid ? '第一负责人' : row.secondPersonId == row.uid ? '第二负责人' : row.thirdPersonId == row.uid ? "第三负责人" : row.fourthPersonId == row.uid ? "第四负责人" : "不是负责人";
          }
        },
        {
          field: 'responsibilityTier',
          title: '积分',
          align: 'center',
          formatter: function (value, row, index) {
            //console.log("row=",row)
            if (row.state == 6) {
              return row.firstPersonId == row.uid ? row.firstPoints : row.secondPersonId == row.uid ? row.secondPoints : row.thirdPersonId == row.uid ? row.thirdPoints : row.fourthPersonId == row.uid ? row.forthPoints : 0;
            } else {
              return 0;
            }
          }
        },
        {
          title: '操作',
          align: 'center',
          formatter: function (value, row, index) {
            var actions = [];
            if (row.state == 6) {
              //actions.push('<a  class="btn btn-success btn-xs ' + editInfo + '" href="javascript:void(0)" onclick="$.operate.overdetailTab(\'' + row.id +'/chakan'+ '\')"><i class="fa fa-edit"></i>查看</a> ');
              actions.push('<a  class="link-button ' + '" href="javascript:void(0)" onclick="$.operate.overdetailTab(\'' + row.id + '/chakan' + '\')">查看</a> ');
            }
            return actions.join('');
          }
        }]
    };

    initTable(options0);

    // tab-1
    var options1 = {
      id: "bootstrap-table1",
      toolbar: "toolbar1",
      url: getUrl($('table').attr('id')),
      createUrl: prefix + "/add",
      overUrl: prefix + "/overadd?id={id}",
      detailUrl: prefix + "/detail/{id}",
      updateUrl: prefix + "/edit/{id}",
      removeUrl: prefix + "/remove",
      exportUrl: prefix + "/export",
      subDraftUrl: prefix + "/subDraft/",
      rowStyle: rowStyle0,
      modalName: "横向课题",
      sortOrder: "asc",
      columns: [{
        field: 'number',
        title: '序号',
        width: 5,
        align: 'center',
        switchable: false,
        formatter: function (value, row, index) {
          //return index+1; //序号正序排序从1开始

          //通过表的#id 可以得到每页多少条
          var pageSize = $('#bootstrap-table').bootstrapTable('getOptions').pageSize;
          //通过表的#id 可以得到当前第几页
          var pageNumber = $('#bootstrap-table').bootstrapTable('getOptions').pageNumber;
          //返回每条的序号： 每页条数 * （当前页 - 1 ）+ 序号
          // return pageSize * (pageNumber - 1) + index + 1;
          return $.table.serialNumber(index);
        }
      },
        {
          field: 'id',
          title: '',
          visible: false
        },
        {
          field: 'yname',
          align: 'center',
          title: '学院'
        },
        {
          field: 'dname',
          align: 'center',
          title: '专业'
        },
        {
          field: 'userName',
          align: 'center',
          title: '申请人'
        },
        {
          field: 'topName',
          align: 'center',
          title: '课题名称'
        },
        // {
        //     field: 'topType',
        //     title: '课题类型',
        //     formatter: function(value, row, index) {
        //        return $.table.selectDictLabel(topTypeDatas, value);
        //     }
        // },

        {
          field: 'signingData',
          align: 'center',
          title: '签订日期'
        },
        {
          field: 'amount',
          align: 'center',
          title: '项目金额'
        },
        // {
        //   field: 'pa',
        //   align: 'center',
        //   title: '甲方'
        // },
        // {
        //   field: 'pb',
        //   align: 'center',
        //   title: '乙方'
        // },
        // {
        //   field: 'state',
        //   title: '申请状态',
        //   align: 'center',
        //   formatter: function (value, row, index) {
        //     //console.log("val=",value)
        //     //console.log("row.state=",row.state)
        //     return $.table.selectDictLabel(datas, value);
        //   }
        // },
        {
          field: 'responsibilityTier',
          title: '责任层级',
          align: 'center',
          formatter: function (value, row, index) {
            return row.firstPersonId == row.uid ? '第一负责人' : row.secondPersonId == row.uid ? '第二负责人' : row.thirdPersonId == row.uid ? "第三负责人" : row.fourthPersonId == row.uid ? "第四负责人" : "不是负责人";
          }
        },
        {
          field: 'responsibilityTier',
          title: '积分',
          align: 'center',
          formatter: function (value, row, index) {
            if (row.state == 4) {
              return row.firstPersonId == row.uid ? row.firstPoints : row.secondPersonId == row.uid ? row.secondPoints : row.thirdPersonId == row.uid ? row.thirdPoints : row.fourthPersonId == row.uid ? row.forthPoints : 0;
            } else {
              return 0;
            }
          }
        },
        {
          title: '操作',
          align: 'center',

          formatter: function (value, row, index) {

            console.log("row=", row)
            var actions = [];/* Add this CSS to your stylesheet */

            actions.push('<a  class="link-button" data-toggle="modal" data-target="#myModal" onclick="loadReviewRecords(' + row.id + ', ' + row.state + ')">流程记录</a><br> ');
            actions.push('<a  class="link-button ' + '" href="javascript:void(0)" onclick="$.operate.overdetailTab(\'' + row.id + '/chakan' + '\')"> 查看</a> &nbsp;&nbsp;&nbsp;');
            if (row.state == '15') {
              actions.push('<a   class="link-button' + '" href="javascript:void(0)" onclick="$.operate.editTab(\'' + row.id + '\')">更新</a>');
              actions.push('<a   class="link-button' + '" href="javascript:void(0)" onclick="subDraft(\'' + row.id + '\')">提交草稿</a> &nbsp;');
              actions.push('<a class="del-link-button' + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"> </i>删除</a>');
            }
            //这个role字段是在sql里面写死
            //教研<!-- Update the button to use the new CSS class -->
            if (row.role === 'research') {
              console.log("research=", 1)
              //本专业的，且不是自己
              if (row.deptNamekey === '1' && row.userId != row.uid) {
                //教研的options1只用处理state=1（待教研室处理）和state=11（待学院处理）的
                console.log("row.userId=", row.userId)
                if (row.state == '1') {
                  console.log("this is reaearch 1")
                  actions.push('<a  class="link-button ' + '" href="javascript:void(0)" onclick="$.operate.detailTab(\'' + row.id + '/pro' + '\')"> 批阅</a> ');
                } else if (row.state == '11') {
                  actions.push('<a  class="del-link-button ' + '" href="javascript:void(0)" onclick="$.operate.detailTab(\'' + row.id + '/pro' + '\')"> 撤回</a> ');
                }
                if (row.userId == row.uid) {
                  actions.push('<a   class="link-button ' + '" href="javascript:void(0)" onclick="$.operate.editTab(\'' + row.id + '\')"> 更新</a> <br>');
                  actions.push('<a class="del-link-button ' + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"> </i>删除</a>');
                }

              }
              //是自己的
              else if (row.userId == row.uid) {
                if (row.state == '1') {
                  //actions.push('<a   class="link-button ' + '" href="javascript:void(0)" onclick="$.operate.editTab(\'' + row.id + '\')"> 更新</a> ');
                  actions.push('<a  class="link-button ' + '" href="javascript:void(0)" onclick="$.operate.detailTab(\'' + row.id + '/pro' + '\')"> 批阅</a> ');
                  //actions.push('<a class="del-link-button ' + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"> </i>删除</a>');
                }
                //待申请结题
                else if (row.state == '4') {
                  actions.push('<a  class="link-button ' + '" href="javascript:void(0)" onclick="$.operate.overTab(\'' + row.id + '\')"> 申请结项</a> ');
                } else if (row.state == '3' || row.state == '12' || row.state == '5') {
                  //被三方驳回
                  actions.push('<a   class="link-button ' + '" href="javascript:void(0)" onclick="$.operate.editTab(\'' + row.id + '\')"> 更新</a> ');
                  //actions.push('<a   class="link-button ' + '" href="javascript:void(0)" onclick="submitto(\'' + row.id + '\', \'' + row.state + '\')"> 提交</a> ');
                } else {
                  //actions.push('<a  class="link-button ' + '" href="javascript:void(0)" onclick="$.operate.overdetailTab(\'' + row.id + '/chakan' + '\')"> 查看</a> ');
                }
              }
              else {
                //不是自己项目，审批过的
                //actions.push('<a  class="link-button ' + '" href="javascript:void(0)" onclick="$.operate.overdetailTab(\'' + row.id + '/chakan' + '\')"> 查看</a> ');
              }
            }
            //学院
            else if (row.role === 'dept_teacher') {
              //学院的options1只用处理state=11（待学院处理）和state=2（待科研处理）的
              if (row.state == '11') {
                actions.push('<a  class="link-button ' + XYPY + '" href="javascript:void(0)" onclick="$.operate.detailTab(\'' + row.id + '/dept_teacher' + '\')"> 批阅</a> ');
                //actions.push('<a  class="link-button ' + '" href="javascript:void(0)" onclick="$.operate.overdetailTab(\'' + row.id + '/chakan' + '\')"> 查看</a> ');
              } else if (row.state == '2') {
                actions.push('<a  class="del-link-button' + XYPY + '" href="javascript:void(0)" onclick="$.operate.detailTab(\'' + row.id + '/dept_teacher' + '\')"> 撤回</a> ');
                //actions.push('<a  class="link-button ' + '" href="javascript:void(0)" onclick="$.operate.overdetailTab(\'' + row.id + '/chakan' + '\')"> 查看</a> ');
              } else {
                //自己的项目
                if (row.userId == row.uid) {
                  if (row.state == '1') {
                    //actions.push('<a   class="link-button ' + '" href="javascript:void(0)" onclick="$.operate.editTab(\'' + row.id + '\')"> 更新</a> <br>');
                    //actions.push('<a class="del-link-button ' + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"> </i>删除</a>');
                  }
                  //待申请结题
                  else if (row.state == '4') {
                    actions.push('<a  class="link-button ' + '" href="javascript:void(0)" onclick="$.operate.overTab(\'' + row.id + '\')"> 申请结项</a> ');
                  } else if (row.state == '3' || row.state == '12' || row.state == '5') {
                    //被三方驳回
                    actions.push('<a   class="link-button ' + '" href="javascript:void(0)" onclick="$.operate.editTab(\'' + row.id + '\')"> 更新</a> ');
                    //actions.push('<a   class="link-button ' + '" href="javascript:void(0)" onclick=""submitto(\'' + row.id + '\', \'' + row.state + '\')"> 提交</a> ');
                  } else {
                    //actions.push('<a  class="link-button ' + '" href="javascript:void(0)" onclick="$.operate.overdetailTab(\'' + row.id + '/chakan' + '\')"> 查看</a> ');
                  }
                } else {
                  //不是自己项目，审批过的
                  //actions.push('<a  class="link-button ' + '" href="javascript:void(0)" onclick="$.operate.overdetailTab(\'' + row.id + '/chakan' + '\')"> 查看</a> ');
                }
              }

            }
            //科研
            else if (row.role === 'sci_tesearch') {
              //科研的options1只用处理state=2（待科研处理）和state=4（待申请结题）的
              if (row.state == '2') {
                actions.push('<a  class="link-button ' + KYPY + '" href="javascript:void(0)" onclick="$.operate.detailTab(\'' + row.id + '/hecha' + '\')"> 批阅</a> ');
                //actions.push('<a  class="link-button ' + '" href="javascript:void(0)" onclick="$.operate.overdetailTab(\'' + row.id + '/chakan' + '\')"> 查看</a> ');
              } else if (row.state == '4') {
                actions.push('<a  class="del-link-button ' + KYPY + '" href="javascript:void(0)" onclick="$.operate.detailTab(\'' + row.id + '/hecha' + '\')"> 撤回</a> <br>');
                //actions.push('<a  class="link-button ' + '" href="javascript:void(0)" onclick="$.operate.overdetailTab(\'' + row.id + '/chakan' + '\')"> 查看</a> &nbsp;&nbsp;&nbsp;');
                if (row.userId == row.uid){
                  actions.push('<a  class="link-button ' + '" href="javascript:void(0)" onclick="$.operate.overTab(\'' + row.id + '\')"> 申请结项</a> ');
                }
              } else {
                //上面的这个else是为了保证批阅的时候没有查看
                //自己的项目
                if (row.userId == row.uid) {
                  if (row.state == '1') {
                    //actions.push('<a   class="link-button ' + '" href="javascript:void(0)" onclick="$.operate.editTab(\'' + row.id + '\')"> 更新</a> ');
                    //actions.push('<a class="del-link-button ' + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"> </i>删除</a>');
                  }
                  //待申请结题
                  else if (row.state == '4') {
                    //actions.push('<a  class="link-button ' + '" href="javascript:void(0)" onclick="$.operate.overTab(\'' + row.id + '\')"> 申请结项</a> ');
                  } else if (row.state == '3' || row.state == '12' || row.state == '5') {
                    //被三方驳回
                    actions.push('<a   class="link-button ' + '" href="javascript:void(0)" onclick="$.operate.editTab(\'' + row.id + '\')"> 更新</a> ');
                    //actions.push('<a   class="link-button ' + '" href="javascript:void(0)" onclick=""submitto(\'' + row.id + '\', \'' + row.state + '\')"> 提交</a> ');
                  } else {
                    //actions.push('<a  class="link-button ' + '" href="javascript:void(0)" onclick="$.operate.overdetailTab(\'' + row.id + '/chakan' + '\')"> 查看</a> ');
                  }
                } else {
                  //不是自己项目，审批过的
                  //actions.push('<a  class="link-button ' + '" href="javascript:void(0)" onclick="$.operate.overdetailTab(\'' + row.id + '/chakan' + '\')"> 查看</a> ');
                }

              }

            }
            //admin
            else if (row.role === 'admin') {
              actions.push('<a  class="link-button ' + '" href="javascript:void(0)" onclick="$.operate.overdetailTab(\'' + row.id + '/chakan' + '\')"> 查看</a> ');
            }
            //教师
            else if (row.role === 'teacher') {
              console.log("teacher", row.state);
              if (row.userId == row.uid) {
                if (row.state == '1') {
                  //actions.push('<a   class="link-button ' + '" href="javascript:void(0)" onclick="$.operate.editTab(\'' + row.id + '\')"> 更新</a> ');
                  //actions.push('<a class="del-link-button ' + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"> </i>删除</a>');
                } else if (row.state == '4') {
                  actions.push('<a  class="link-button ' + '" href="javascript:void(0)" onclick="$.operate.overTab(\'' + row.id + '\')"> 申请结项</a> ');
                } else if (row.state == '3' || row.state == '12' || row.state == '5') {
                  actions.push('<a   class="link-button ' + '" href="javascript:void(0)" onclick="$.operate.editTab(\'' + row.id + '\')"> 更新</a> ');
                  //actions.push('<a   class="link-button ' + '" href="javascript:void(0)" onclick="submitto(\'' + row.id + '\', \'' + row.state + '\')"> 提交</a> ');
                } else {
                  //actions.push('<a  class="link-button ' + '" href="javascript:void(0)" onclick="$.operate.overdetailTab(\'' + row.id + '/chakan' + '\')"> 查看</a> ');
                }
              } else {
                //actions.push('<a  class="link-button ' + '" href="javascript:void(0)" onclick="$.operate.overdetailTab(\'' + row.id + '/chakan' + '\')"> 查看</a> ');

              }
            }
            //return actions.join('');
            return arrangeButtons(actions)
          }
        }]
    };
    initTable(options1);

    // tab-2
    var options2 = {
      id: "bootstrap-table2",
      toolbar: "toolbar2",
      url: getUrl($('table').attr('id')),
      createUrl: prefix + "/overadd?id={id}",
      detailUrl: prefix + "/overdetail/{id}",
      updateUrl: prefix + "/edit/{id}",
      removeUrl: prefix + "/remove",
      exportUrl: prefix + "/export",
      subDraftUrl: prefix + "/subDraft/",
      rowStyle: rowStyle0,
      modalName: "横向课题结项",
      sortOrder: "asc",
      columns: [{
        field: 'number',
        title: '序号',
        width: 5,
        align: 'center',
        switchable: false,
        formatter: function (value, row, index) {
          //return index+1; //序号正序排序从1开始

          //通过表的#id 可以得到每页多少条
          var pageSize = $('#bootstrap-table').bootstrapTable('getOptions').pageSize;
          //通过表的#id 可以得到当前第几页
          var pageNumber = $('#bootstrap-table').bootstrapTable('getOptions').pageNumber;
          //返回每条的序号： 每页条数 * （当前页 - 1 ）+ 序号
          // return pageSize * (pageNumber - 1) + index + 1;
          return $.table.serialNumber(index);
        }
      },
        {
          field: 'id',
          title: '',
          visible: false
        },
        {
          field: 'yname',
          align: 'center',
          title: '学院'
        },
        {
          field: 'dname',
          align: 'center',
          title: '专业'
        },
        {
          field: 'userName',
          align: 'center',
          title: '申请人'
        },
        {
          field: 'topName',
          align: 'center',
          title: '课题名称'
        },
        // {
        //     field: 'topType',
        //     title: '课题类型',
        //     formatter: function(value, row, index) {
        //        return $.table.selectDictLabel(topTypeDatas, value);
        //     }
        // },

        {
          field: 'signingData',
          align: 'center',
          title: '签订日期'
        },
        {
          field: 'amount',
          align: 'center',
          title: '项目金额'
        },
        // {
        //   field: 'pa',
        //   align: 'center',
        //   title: '甲方'
        // },
        // {
        //   field: 'pb',
        //   align: 'center',
        //   title: '乙方'
        // },
        // {
        //   field: 'state',
        //   title: '申请状态',
        //   align: 'center',
        //   formatter: function (value, row, index) {
        //     return $.table.selectDictLabel(datas, value);
        //   }
        // },
        {
          field: 'responsibilityTier',
          title: '责任层级',
          align: 'center',
          formatter: function (value, row, index) {
            return row.firstPersonId == row.uid ? '第一负责人' : row.secondPersonId == row.uid ? '第二负责人' : row.thirdPersonId == row.uid ? "第三负责人" : row.fourthPersonId == row.uid ? "第四负责人" : "不是负责人";
          }
        },
        {
          field: 'responsibilityTier',
          title: '积分',
          align: 'center',
          formatter: function (value, row, index) {
            if (row.state == 6) {
              return row.firstPersonId == row.uid ? row.firstPoints : row.secondPersonId == row.uid ? row.secondPoints : row.thirdPersonId == row.uid ? row.thirdPoints : row.fourthPersonId == row.uid ? row.forthPoints : 0;
            } else {
              return 0;
            }
          }
        },
        {
          title: '操作',
          align: 'center',
          formatter: function (value, row, index) {
            var actions = [];
            actions.push('<a  class="link-button" data-toggle="modal" data-target="#myModal" onclick="loadReviewRecords(' + row.id + ', ' + row.state + ')">流程记录</a><br> ');
            actions.push('<a  class="link-button ' + '" href="javascript:void(0)" onclick="$.operate.overdetailTab(\'' + row.id + '/chakan' + '\')"> 查看</a>');
            //教研
            if (row.role === 'research') {
              //如果这个项目所属的教研室是登陆人的教研室
              if (row.deptNamekey === '1') {
                //教研的options1只用处理state=7（待教研室处理）和state=13（待学院处理）的
                if (row.state == '7') {
                  actions.push('<a  class="link-button ' + JYPY + '" href="javascript:void(0)" onclick="$.operate.detailTab(\'' + row.id + '/JYSOVER' + '\')"> 批阅</a> ');
                } else if (row.state == '13') {
                  actions.push('<a  class="del-link-button ' + JYPY + '" href="javascript:void(0)" onclick="$.operate.detailTab(\'' + row.id + '/JYSOVER' + '\')"> 撤回</a> ');
                }
              }
              //上面的这个else是为了保证批阅的时候没有查看
              //自己的项目
              if (row.userId == row.uid) {
                if (row.state == '7') {
                  actions.push('<a   class="link-button ' + '" href="javascript:void(0)" onclick="$.operate.editTab(\'' + row.id + '\')"> 更新</a><br> ');
                  actions.push('<a class="del-link-button ' + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"> </i>删除</a>');
                } else if (row.state == '9' || row.state == '10' || row.state == '14') {
                  //被三方驳回
                  actions.push('<a   class="link-button ' + '" href="javascript:void(0)" onclick="$.operate.editTab(\'' + row.id + '\')"> 更新</a> ');
                  //actions.push('<a   class="link-button ' + '" href="javascript:void(0)" onclick="submitto(\'' + row.id + '\', \'' + row.state + '\')"> 提交</a> ');
                } else {
                  //actions.push('<a  class="link-button ' + '" href="javascript:void(0)" onclick="$.operate.overdetailTab(\'' + row.id + '/chakan' + '\')"> 查看</a> ');
                }

              }
              else {
                //不是自己项目,审批过的
                //actions.push('<a  class="link-button ' + '" href="javascript:void(0)" onclick="$.operate.overdetailTab(\'' + row.id + '/chakan' + '\')"> 查看</a> ');
              }
            }
            //学院
            else if (row.role === 'dept_teacher') {
              //学院的options1只用处理state=13（待学院处理）和state=8（待科研处理）的
              if (row.state == '13') {
                actions.push('<a  class="link-button ' + XYPY + '" href="javascript:void(0)" onclick="$.operate.detailTab(\'' + row.id + '/dept_teacher' + '\')"> 批阅</a> ');
              } else if (row.state == '8') {
                actions.push('<a  class="del-link-button ' + XYPY + '" href="javascript:void(0)" onclick="$.operate.detailTab(\'' + row.id + '/dept_teacher' + '\')"> 撤回</a> ');
              } else {
                //审批过的
                //actions.push('<a  class="link-button ' + '" href="javascript:void(0)" onclick="$.operate.overdetailTab(\'' + row.id + '/chakan' + '\')"> 查看</a> ');

              }

            }
            //科研
            else if (row.role === 'sci_tesearch') {
              //科研的options1只用处理state=8（待科研处理）和state=6（完结）的
              if (row.state == '8') {
                actions.push('<a  class="link-button ' + KYPY + '" href="javascript:void(0)" onclick="$.operate.detailTab(\'' + row.id + '/KYCOVER' + '\')"> 批阅</a> ');
              } else if (row.state == '6') {
                actions.push('<a  class="del-link-button ' + KYPY + '" href="javascript:void(0)" onclick="$.operate.detailTab(\'' + row.id + '/KYCOVER' + '\')"> 撤回</a> ');
              } else {
                //上面的这个else是为了保证批阅的时候没有查看
                //自己的项目
                if (row.userId == row.uid) {
                  if (row.state == '1') {
                    actions.push('<a   class="link-button ' + '" href="javascript:void(0)" onclick="$.operate.editTab(\'' + row.id + '\')"> 更新</a><br> ');
                    actions.push('<a class="del-link-button ' + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"> </i>删除</a>');
                  } else if (row.state == '9' || row.state == '10' || row.state == '14') {
                    //被三方驳回
                    actions.push('<a   class="link-button ' + '" href="javascript:void(0)" onclick="$.operate.editTab(\'' + row.id + '\')"> 更新</a> ');
                    //actions.push('<a   class="link-button ' + '" href="javascript:void(0)" onclick="submitto(\'' + row.id + '\', \'' + row.state + '\')"> 提交</a> ');
                  } else {
                    //actions.push('<a  class="link-button ' + '" href="javascript:void(0)" onclick="$.operate.overdetailTab(\'' + row.id + '/chakan' + '\')"> 查看</a> ');
                  }
                } else {
                  //不是自己项目，审批过的
                  //actions.push('<a  class="link-button ' + '" href="javascript:void(0)" onclick="$.operate.overdetailTab(\'' + row.id + '/chakan' + '\')"> 查看</a> ');

                }

              }

            }
            //admin
            else if (row.role === 'admin') {
              actions.push('<a  class="link-button ' + '" href="javascript:void(0)" onclick="$.operate.overdetailTab(\'' + row.id + '/chakan' + '\')"> 查看</a> ');
            }
            //普通教师
            else if (row.role === 'teacher') {
              if (row.userId == row.uid) {
                if (row.state == '16'){
                  actions.push('<a   class="link-button ' + '" href="javascript:void(0)" onclick="$.operate.editTab(\'' + row.id + '\')"> 更新</a><br> ');
                  actions.push('<a   class="link-button' + '" href="javascript:void(0)" onclick="subDraft(\'' + row.id + '\')">提交草稿</a> ');

                }
                if (row.state == '7') {
                  //actions.push('<a   class="link-button ' + '" href="javascript:void(0)" onclick="$.operate.editTab(\'' + row.id + '\')"> 更新</a> ');
                  //actions.push('<a class="del-link-button ' + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"> </i>删除</a>');
                } else if (row.state == '9' || row.state == '10' || row.state == '14') {
                  //被三方驳回
                  actions.push('<a   class="link-button ' + '" href="javascript:void(0)" onclick="$.operate.editTab(\'' + row.id + '\')"> 更新</a> ');
                  //actions.push('<a   class="link-button ' + '" href="javascript:void(0)" onclick="submitto(\'' + row.id + '\', \'' + row.state + '\')"> 提交</a> ');
                } else {
                  //actions.push('<a  class="link-button ' + '" href="javascript:void(0)" onclick="$.operate.overdetailTab(\'' + row.id + '/chakan' + '\')"> 查看</a> ');
                }
              } else {
                //actions.push('<a  class="link-button ' + '" href="javascript:void(0)" onclick="$.operate.overdetailTab(\'' + row.id + '/chakan' + '\')"> 查看</a> ');
              }
            }
            // if (row.role==='sci_tesearch'){
            //     if(row.state == '7' || row.state == '9'|| row.state == '10'){
            //         if(row.userId == row.uid){
            //             actions.push('<a class="btn btn-danger btn-xs '  + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"> </i>删除</a>');
            //             actions.push('<a   class="btn btn-success btn-xs '  + '" href="javascript:void(0)" onclick="$.operate.editTab(\'' + row.id + '\')"> 更新</a> ');
            //             if( row.state == '9'|| row.state == '10') {
            //                 actions.push('<a class="btn btn-success btn-xs" href="javascript:void(0)" onclick="submitto(\'' + row.id + '\', \'' + row.state + '\')">  提交</a>');
            //             }
            //         }else {
            //             //todo:这个查看只能查看，不能进行任何操作
            //             actions.push('<a  class="btn btn-success btn-xs '  + '" href="javascript:void(0)" onclick="$.operate.detailTab(\'' + row.id +'/chakan'+ '\')"> 查看</a> ');
            //         }
            //     }
            //     else if(row.state=='6') {
            //         if (row.userId == row.uid) {
            //             //actions.push('<a  class="btn btn-success btn-xs ' + '" href="javascript:void(0)" onclick="$.operate.overTab(\'' + row.id + '\')"> 申请结项</a> ');
            //             actions.push('<a  class="btn btn-success btn-xs ' + '" href="javascript:void(0)" onclick="$.operate.detailTab(\'' + row.id + '/chakan' + '\')"> 查看</a> ');
            //         }else {
            //             //todo:这个查看只能查看，不能进行任何操作
            //             actions.push('<a  class="btn btn-success btn-xs '  + '" href="javascript:void(0)" onclick="$.operate.detailTab(\'' + row.id +'/chakan'+ '\')"> 查看</a> ');
            //         }
            //     }
            //     else if (row.state=='8'){
            //         actions.push('<a  class="btn btn-success btn-xs ' +  '" href="javascript:void(0)" onclick="$.operate.detailTab(\'' + row.id+'/KYCOVER' + '\')"> 核查</a> ');
            //     }
            // }
            // else if (row.role==='teacher'){
            //     if(row.state == '7' || row.state == '9'|| row.state == '10'){
            //         if(row.userId == row.uid){
            //             actions.push('<a class="btn btn-danger btn-xs '  + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"> </i>删除</a>');
            //             actions.push('<a   class="btn btn-success btn-xs '  + '" href="javascript:void(0)" onclick="$.operate.editTab(\'' + row.id + '\')"> 更新</a> ');
            //             if( row.state == '9'|| row.state == '10') {
            //                 actions.push('<a class="btn btn-success btn-xs" href="javascript:void(0)" onclick="submitto(\'' + row.id + '\', \'' + row.state + '\')">  提交</a>');
            //             }
            //         }else {
            //             //todo:这个查看只能查看，不能进行任何操作
            //             actions.push('<a  class="btn btn-success btn-xs '  + '" href="javascript:void(0)" onclick="$.operate.detailTab(\'' + row.id +'/chakan'+ '\')"> 查看</a> ');
            //         }
            //     } else if(row.state=='6') {
            //         if (row.userId == row.uid) {
            //             //actions.push('<a  class="btn btn-success btn-xs ' + '" href="javascript:void(0)" onclick="$.operate.overTab(\'' + row.id + '\')"> 申请结项</a> ');
            //             actions.push('<a  class="btn btn-success btn-xs ' + '" href="javascript:void(0)" onclick="$.operate.detailTab(\'' + row.id + '/chakan' + '\')"> 查看</a> ');
            //         }else {
            //             //todo:这个查看只能查看，不能进行任何操作
            //             actions.push('<a  class="btn btn-success btn-xs '  + '" href="javascript:void(0)" onclick="$.operate.detailTab(\'' + row.id +'/chakan'+ '\')"> 查看</a> ');
            //         }
            //     }else if (row.state=='8'){
            //     }
            // }
            // else if (row.role==='research'){
            //     if(row.state == '8' ||row.state == '13' ){
            //         actions.push('<a  class="btn btn-success btn-xs ' +  '" href="javascript:void(0)" onclick="$.operate.detailTab(\'' + row.id+'/JYSOVER' + '\')"> 核查</a> ');
            //     }
            //     if(row.userId == row.uid){
            //         if(row.state=='4') {
            //             actions.push('<a  class="btn btn-success btn-xs ' + '" href="javascript:void(0)" onclick="$.operate.overTab(\'' + row.id + '\')"> 申请结项</a> ');
            //         }else if(row.state=='3'||row.state=='12'||row.state=='15'){
            //             actions.push('<a   class="btn btn-success btn-xs '  + '" href="javascript:void(0)" onclick="$.operate.editTab(\'' + row.id + '\')"> 更新</a> ');
            //             actions.push('<a   class="btn btn-success btn-xs ' + '" href="javascript:void(0)" onclick="submitto(\'' + row.id + '\')"> 提交</a> ');
            //         }
            //     }
            // //     if(row.state == '8' || row.state == '9'|| row.state == '10'){
            // //         if(row.userId == row.uid){
            // //             actions.push('<a class="btn btn-danger btn-xs '  + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"> </i>删除</a>');
            // //             actions.push('<a   class="btn btn-success btn-xs '  + '" href="javascript:void(0)" onclick="$.operate.editTab(\'' + row.id + '\')"> 更新</a> ');
            // //             if( row.state == '9'|| row.state == '10') {
            // //                 actions.push('<a class="btn btn-success btn-xs" href="javascript:void(0)" onclick="submitto(\'' + row.id + '\', \'' + row.state + '\')">  提交</a>');
            // //             }
            // //         }else {
            // //             //todo:这个查看只能查看，不能进行任何操作
            // //             actions.push('<a  class="btn btn-success btn-xs '  + '" href="javascript:void(0)" onclick="$.operate.detailTab(\'' + row.id +'/chakan'+ '\')"> 查看</a> ');
            // //         }
            // //     } else if(row.state=='6') {
            // //         if (row.userId == row.uid) {
            // //             //actions.push('<a  class="btn btn-success btn-xs ' + '" href="javascript:void(0)" onclick="$.operate.overTab(\'' + row.id + '\')"> 申请结项</a> ');
            // //             actions.push('<a  class="btn btn-success btn-xs ' + '" href="javascript:void(0)" onclick="$.operate.detailTab(\'' + row.id + '/chakan' + '\')"> 查看</a> ');
            // //         }else {
            // //             actions.push('<a  class="btn btn-success btn-xs '  + '" href="javascript:void(0)" onclick="$.operate.detailTab(\'' + row.id +'/chakan'+ '\')"> 查看</a> ');
            // //         }
            // //     }else if (row.state=='7'){
            // //         actions.push('<a  class="btn btn-success btn-xs ' +  '" href="javascript:void(0)" onclick="$.operate.detailTab(\'' + row.id+'/JYSOVER' + '\')"> 核查</a> ');
            // //     }
            //  }
            // else if (row.role==='admin'){
            //     actions.push('<a  class="btn btn-success btn-xs ' + '" href="javascript:void(0)" onclick="$.operate.overdetailTab(\'' + row.id +'/chakan'+ '\')"> 查看</a> ');
            // }
            // else if (row.role==='dept_teacher'){
            //     actions.push('<a  class="btn btn-success btn-xs ' + '" href="javascript:void(0)" onclick="$.operate.overdetailTab(\'' + row.id +'/chakan'+ '\')"> 查看</a> ');
            //     if (row.state == '13'){
            //         actions.push('<a  class="btn btn-success btn-xs ' +  '" href="javascript:void(0)" onclick="$.operate.detailTab(\'' + row.id+'/dept_teacher' + '\')"> 核查</a> ');
            //     }
            // }
            return actions.join('');
          }

        }]
    };
    initTable(options2);

    function refreshBootstrapTable2() {
      var table = $('#bootstrap-table2');
      if (table.length && $.fn.bootstrapTable) {
        table.bootstrapTable('refresh');
      }
    }

    window.addEventListener("storage", function (event) {
      if (event.key === "year") {
        // 销毁表格，再初始化
        $('#bootstrap-table0').bootstrapTable('destroy');
        initTable(options0)
        $('#bootstrap-table1').bootstrapTable('destroy');
        initTable(options1)
        $('#bootstrap-table2').bootstrapTable('destroy');
        initTable(options2)
      }

    })
  });

  function arrangeButtons(actions) {
    let result = '';
    for (let i = 0; i < actions.length; i++) {
      if (i > 0 && i % 3 === 0) {
        result += '<br>'; // 每三个按钮后换行
      }
      result += actions[i];
    }
    return result;
  }

  function submitto(id, state) {
    var data = {"id": id, "state": state}
    $.operate.save(prefix + "/change_sc_edit", data);

  }

  function rowStyle0(row, index) {
    if (["6", "4"].includes(row.state)) {
      console.log("row.state is 6", row.state)
      // 完结 绿色
      return {
        css: {"color": '#67c23a'}

      };
    } else if (["15","4","16"].includes(row.state)) {
      // 草稿 黄色
      return {
        css: {"color": '#c78045'}

      };
    } else if (["1", "2", "11", "7", "8", "13"].includes(row.state)) {
      // 审核中 蓝色
      return {
        css: {"color": '#2c99ff'}

      };
    } else if (["3", "5", "12", "9", "10", "14"].includes(row.state)) {
      // 被驳回
      return {
        // css: {"color": '#ff0000'}
        css: {"color": '#c78045'}
      };
    }
    return {};
  }

  function loadReviewRecords(Id, state) {
    updateProgress(state); // 更新进度条

    //批阅记录
    $.ajax({
      url: prefix + "/bhyy/" + Id, // 替换为实际的API路径
      method: 'POST',
      data: {kid: Id},
      success: function (response) {
        const eventList = document.getElementById('event-list');
        eventList.innerHTML = '';

        response.rows.forEach(function (row) {
          const li = document.createElement('li');
          li.innerHTML = '<i class="node-icon"></i>' +
            '<span class="time">' + row.createTime + '</span>' +
            '<span class="txt">' + row.state + '</span>';
          eventList.insertBefore(li, eventList.firstChild);
        });
      },
      error: function () {
        alert('无法获取批阅记录');
      }
    });
  }

  //显示模态框上面的进度
  function updateProgress(state) {
    // 获取所有步骤元素
    const steps = document.querySelectorAll('.progress_inner__step');
    const progressBar = document.querySelector('.progress_inner__bar--progress');

    // 遍历所有步骤，重置样式
    steps.forEach(step => {
      step.classList.remove('active', 'completed', 'pending');
      step.querySelector('.status-text').classList.remove('active', 'completed');
    });
    // 重置进度条
    progressBar.style.width = '0';

    // 根据 state 设置相应的步骤颜色
    if ([15,9,4].includes(state)) {
      document.getElementById('step-1').classList.add('active');
      document.getElementById('step-1').querySelector('.status-text').classList.add('active');
      progressBar.style.width = '0';
    } else if (state === 6) {
      document.getElementById('step-1').classList.add('completed');
      document.getElementById('step-1').querySelector('.status-text').classList.add('completed');
      document.getElementById('step-2').classList.add('completed');
      document.getElementById('step-2').querySelector('.status-text').classList.add('completed');
      document.getElementById('step-3').classList.add('completed');
      document.getElementById('step-3').querySelector('.status-text').classList.add('completed');
      progressBar.style.width = '100%';
    } else if ([1, 2, 7,8,11,13].includes(state)) {
      document.getElementById('step-1').classList.add('completed');
      document.getElementById('step-1').querySelector('.status-text').classList.add('completed');
      document.getElementById('step-2').classList.add('completed');
      document.getElementById('step-2').querySelector('.status-text').classList.add('completed');
      progressBar.style.width = '50%';
    } else {
      // 默认情况下，所有步骤为灰色
      steps.forEach(step => {
        step.classList.add('pending');
        step.querySelector('.status-text').classList.add('pending');
      });
    }
  }

  function subDraft(id) {
    $.modal.confirm("确定提交吗？", function () {
      var url = table.options.subDraftUrl + id;
      $.operate.submit(url, "post", "json", "");
    });
  }

  /**
   * @param amount
   * @param key 0代表开题，1代表结题
   * @param responsibilityTier 1，2，3，4代表第几负责人,0代表不是负责人
   */
  function getscore_evidence(id, responsibilityTier) {
    if (responsibilityTier === 0) {
      resolve("未参与");
    } else {
      $.ajax({
        type: "POST",
        url: prefix + "/getscore_byId",
        contentType: "application/json",
        data: JSON.stringify({'id': id}),
        async: true,
        error: function (request) {
          reject("系统错误");
        },
        success: function (data) {
          resolve(data.score);
        }
      });
    }
  }


</script>
</body>
</html>
